package com.google.code.dweibo.util;

import com.google.code.dweibo.core.auth.LoginService;
import com.google.code.dweibo.core.auth.LoginType;
import com.google.code.dweibo.core.auth.RenrenLoginService;
import com.google.code.dweibo.core.auth.SinaLoginService;
import com.google.code.dweibo.core.sync.RenRenSyncService;
import com.google.code.dweibo.core.sync.WeiboSyncService;
import com.google.code.dweibo.core.topic.SinaTopicActionService;
import com.google.code.dweibo.core.topic.SinaTopicViewService;
import com.google.code.dweibo.core.user.SinaUserActionService;
import com.google.code.dweibo.core.user.SinaUserViewService;

/** A factory class to get different services
 * 
 * @author jessiejacky
 *
 */
public class WeiboServiceFactory {
	private static final LoginService SINA_LOGIN = new SinaLoginService();
	private static final LoginService RENREN_LOGIN = new RenrenLoginService();
	
	public static LoginService getLoginService(LoginType type) throws Exception{
		switch(type){
			case SINA: return SINA_LOGIN;
			case RENREN: return RENREN_LOGIN;
			default: throw new Exception("unsupported type");
		}
	}
	
	public static SinaUserActionService getUserActionService() throws Exception{
		return new SinaUserActionService();
	}
	
	public static SinaTopicActionService getTopicActionService() throws Exception{
		return new SinaTopicActionService();
		
	}
	
	public static SinaUserViewService getUserViewService() throws Exception{
		return new SinaUserViewService();
	}
	
	public static SinaTopicViewService getTopicViewService() throws Exception{
		return new SinaTopicViewService();
		
	}
	
	public static WeiboSyncService getSyncService(LoginType type) throws Exception{
		switch(type){
			case RENREN: return new RenRenSyncService();
			default: throw new Exception("unsupported type");
		}
	}
	
}
